﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LIB
{
    public abstract class AbstactStone
    {
        public int weight { set; get; }

        public int cost { set; get; }
        public AbstactStone(int w, int c)
        {
            weight = w;
            cost = c;
        }

    }

    public class JewelStone : AbstactStone
    {
        string Country;
        int Quality;
        public JewelStone(int w, int c)
            : base(w, c)
        {
        }
    }
    public class SemipreciousStone : AbstactStone
    {
        string Country;
        int Quality;
        public SemipreciousStone(int w, int c)
            : base(w, c)
        {

        }
    }

    public class Adamant : JewelStone
    {
        int carat;
        object nameOfAdamant;

        public Adamant(int w, int c)
            : base(w, c)
        {
        }
    }
    public class Brilliant : JewelStone
    {
        int carat;
        object nameOfBrilliant;

        public Brilliant(int w, int c)
            : base(w, c)
        {
        }
    }
    public class Azurestone : SemipreciousStone
    {
        int carat;
        object nameOfAzure;
        public Azurestone(int w, int c)
            : base(w, c)
        {
        }
    }

    public class Necklace
    {
        public List<AbstactStone> jewel = new List<AbstactStone>();
        int count;
        public int Get_sum()
        {
            int sum = 0;
            foreach (AbstactStone cur in jewel)
                sum += cur.cost;
            return sum;
        }
        public int Get_weight()
        {
            int w = 0;
            foreach (AbstactStone cur in jewel)
                w += cur.weight;
            return w;
        }

        public void add(AbstactStone ab)
        {
            jewel.Add(ab);
            count++;
        }
        public string remove(int num)
        {
            try
            {
                jewel.RemoveAt(num - 1);
                count--;
                return "Объект удален";
            }
            catch (Exception)
            {
                return "Неверный индекс массива";
            }
        }
    }
        public abstract class Creator
        {
            public abstract AbstactStone FactoryMethod(int w, int c);
        }

        public class AzurestoneCreator : Creator
        {
            public override AbstactStone FactoryMethod(int w, int c)
            {
                return new Azurestone(w, c);
            }
        }
        public class AdamantCreator : Creator
        {
            public override AbstactStone FactoryMethod(int w, int c)
            {
                return new Adamant(w, c);
            }
        }
        public class BrilliantCreator : Creator
        {
            public override AbstactStone FactoryMethod(int w, int c)
            {
                return new Brilliant(w, c);
            }
        }
    
}
